# 需求：计算1~100所有数字的累加和，1 + 2 + 3 …… 100
# 要求：通过 for 循环配合 range() 方法实现
# s=0
# for i in range(101):
#     s+=i
# print(s)

# 需求：封装一个函数，实现start~end(包含start、end)之间所有数的累加，返回累加的结果
# 1. start、end为形参，默认值分别为1和100
# 2. 返回累加的结果
# 3. 调用函数，传递参数，测试函数的调用情况

# def aa(start=1,end=100):
#     count = 0
#     for i in range(start,end+1):
#         count = count + i
#         print(i)
#     return count
#
# ret = aa()
# print(ret)



# def aa(start=1,end=100):
#     num=0
#     while start<=end:
#         num+=start
#         start+=1
#         print(start)
#     return num
#
# print(aa())

# user_list = []
# def student():
#     i = 1
#     while i<=2:
#         name = input("输入姓名:")
#         age = input("输入年龄: ")
#         user_list.append({
#             "name":name,
#             "age":age,
#             "id": i
#
#         })
#
#         i = i+1
#     return user_list
# stu = student()
# print(stu)
#
# def show_stu_info():
#     print('--------学生信息列表---------')
#     for item in user_list:
#         print(f"{item.get('id')}\t\t{item.get('name')}\t\t{item.get('age')}")
#     print('--------------------------')
# show_stu_info()








# 需求：封装一个函数，实现start~end(包含start、end)之间所有数的累加，返回累加的结果
# 1. start、end为形参，默认值分别为1和100
# 2. 返回累加的结果
# 3. 调用函数，传递参数，测试函数的调用情况

# def summary(start=1,end=100):
#     sum=0
#     for num in range(start,end+1):
#         sum+=num
#     return sum
# print(summary())
#


# def summary(start=1,end=100):
#     sum = 0
#     while start<=end:
#         sum=sum+start
#         start=start+1
#     return sum
#
# print(summary())








